<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>递归画倒三角</title>
</head>
<body>
    <script>
        function star(num) {
            if(num == 0){
                return "";
            }
            document.write("*".repeat(num) + "<br>");
            star(--num);

            // 简写
            // num == 0 ? '' : document.write("*".repeat(num) + "<br>") || star(--num);
        }
        star(5);
    </script>
</body>
</html>